package com.button.sharding.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.button.sharding.dao.UserMapper;
import com.button.sharding.pojo.User;
import com.button.sharding.service.UserService;

@Service
public class UserServiceImpl implements UserService{
	@Autowired
	private UserMapper userMapper;

	@Override
	public void saveUser() {
		for(int i = 1; i < 100; i++) {
			User user = new User();
			user.setUserAge(i + 1);
			user.setUserId(i);
			user.setUserName("测试" + i);
			userMapper.saveUser(user);
		}
	}

	@Override
	public User selectUser(Integer userId) {
		return userMapper.selectUser(userId);
	}
}
